#pragma once

#include "Engine.h"

/**
* @file Resources.h
* @brief Singleton to manage loaded resources
*/
class Resources
{
#pragma region SINGLETON
public:
	static Resources* GetInstance()
	{
		if (instance == nullptr)
			instance = new Resources();
		return instance;
	}
	static void Kill()
	{
		if (instance != nullptr)
		{
			delete instance;
			instance = nullptr;
		}
	}
private:
	Resources();
	Resources(const Resources& other);
	~Resources();

	static Resources* instance;

	Resources& operator=(const Resources& other);
#pragma endregion
public:
	SDL_Texture* GetTexture(const std::string& path);
	TTF_Font* GetFont(const std::string& path, int size);

private:
	std::map<std::string, SDL_Texture*> loadedTextures;
	std::map<std::string, TTF_Font*> loadedFonts;
	SDL_Texture* LoadImage(const std::string& path, SDL_Renderer* renderer);
	TTF_Font* LoadFont(const std::string& path, int size);
};
